package com.travelsupport.ui;

import com.travelsupport.controller.DbController;
import com.travelsupport.myobject.CatalogObj;
import com.travelsupport.myobject.LocationObj;

import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.sip.SipSession.State;
import android.nfc.Tag;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Toast;

public class MainActivity extends Activity {

	private static final String Tag = "MainActivity";

	DbController dbController = null;

	// SQLiteDatabase db = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {

		Log.i(Tag, "onCeate");

		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		// db=(new DbController(this)).getWritableDatabase();

		// if(checkNetWorkAvaiable() ) {
		//
		// //Toast t = new Toast("No network connected");
		// Toast toast = Toast.makeText(getApplicationContext(),
		// "Network connected", 10);
		// toast.show();
		//
		//
		// }
		// else
		// {
		// Toast toast = Toast.makeText(getApplicationContext(),
		// "No network connected", 10);
		// toast.show();
		// }

		/*
		 * Intent i = new Intent(MainActivity.this,DbController.class);
		 * startActivity(i);
		 */

		// dbController = new DbController(getApplicationContext());
		// dbController = new DbController(getBaseContext());
		// dbController.selectCatalog();

		// dbController = new DbController(this);

		// dbController.onCreate(db);

		// dbController.selectCatalog();
	}

	// public boolean checkNetWorkAvaiable(){ //should be rename as
	// checkNetWorkConnected
	// boolean isConneted = false;
	//
	// ConnectivityManager conMgr =
	// (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
	//
	// if ( conMgr.getNetworkInfo(0).getState() == NetworkInfo.State.CONNECTED
	// || conMgr.getNetworkInfo(1).getState() == NetworkInfo.State.CONNECTING )
	// {
	//
	// isConneted = true;
	// }
	// else if ( conMgr.getNetworkInfo(0).getState() ==
	// NetworkInfo.State.DISCONNECTED
	// || conMgr.getNetworkInfo(1).getState() == NetworkInfo.State.DISCONNECTED)
	// {
	//
	// isConneted = false;
	// }
	//
	// return isConneted;
	// }
	//
	//
	//
	// public void settingClick(){
	//
	// }
	//
	// public void catalogItemClick(){
	//
	// }

	public void Currency(View view) {
		startActivity(new Intent(MainActivity.this, CurrencyActivity.class));
	}
	
	public void MyFavorite(View view) {
		startActivity(new Intent(MainActivity.this, MyFavoriteActivity.class));
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
}
